/*
 * @Author: wwssaabb
 * @Date: 2021-06-08 16:07:39
 * @LastEditTime: 2021-06-15 10:01:57
 * @FilePath: \demo\koa2_demo\app.js
 */

const koa=require('koa')
const app=new koa()

//引入并使用responseDuration中间件
const resDuration=require('./middleware/koa_response_duration.js')
app.use(resDuration)

//引入并使用responseHeader中间件
const responseHeader=require('./middleware/koa_response_header.js')
app.use(responseHeader)

//引入并使用responseData中间件
const responseData=require('./middleware/koa_response_data.js')
app.use(responseData)

app.listen(8888,err=>{
  if(err){
    console.log(err)
  }else{
    console.log('服务器开启成功！')
  }
})

const websocketService=require('./service/web_socket_service')
//开启websocket服务端的监听
websocketService.listen()